package com.goldenKey.common.pojo.enumeration;

/**
 * 图书状态
 */
public enum BookStatusEnum {

    LISTING(1, "上架中"),
    SOLD_OUT(-1, "已下架"),
    HALT_SALES(2, "停售"),
    SHORTAGE(0, "紧缺");

    private Integer status;
    private String desc;

    BookStatusEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static BookStatusEnum getByStatus(Integer status) {
        for(BookStatusEnum item : BookStatusEnum.values()) {
            if(item.getStatus().equals(status)) {
                return item;
            }
        }
        return null;
    }

    public Integer getStatus() {
        return this.status;
    }
    public String getDesc() {
        return this.desc;
    }
}
